{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "内容均为乐学偶得原创 乐学偶得版权所有  公众号：乐学Fintech  主讲人：William LX_LAB教研团队提供技术支持 正版视频： 网易云课堂：乐学偶得"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "10.写一个函数，这个函数能够将你输入的数字进行就判断（如果是奇数，就会显示出是奇数，如果是偶数，也会显示这是偶数）\n",
    "tips: def func(). if else, 奇偶的定义（能否被2整除）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def func(n):\n",
    "    mod = n % 2 \n",
    "    if mod > 0:\n",
    "        print(\"您输入的是一个奇数\")\n",
    "    else:\n",
    "        print(\"您输入的是一个偶数\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您输入的是一个偶数\n"
     ]
    }
   ],
   "source": [
    "func(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您输入的是一个奇数\n"
     ]
    }
   ],
   "source": [
    "func(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
